//
var mode = document.getElementsByClassName('mode')[0];
mode.addEventListener('touchend',function(){
	$('#mode-normal').hide();
});
//
var refister_mobile_btn = document.getElementById('refister_mobile_btn');
refister_mobile_btn.addEventListener('touchend',function(){
	if($('#usermobile').val()==''){
		$('#mode-page').html('手机号不能为空');
		$('#mode-normal').show();
		setTimeout(function(){$('#mode-normal').hide()},1500);
	};
	if($('#mobilecode').val()==''){
		$('#mode-page').html('验证码不能为空');
		$('#mode-normal').show();
		setTimeout(function(){$('#mode-normal').hide()},1500);
	};
});
//
$('#usermobile').on('blur',function(){
	var mobile = $('#usermobile').val();
	if(!(/^1[34578]\d{9}$/.test(mobile))){
		$('#mode-page').html('请输入正确的手机号');
		$('#mode-normal').show();
		setTimeout(function(){$('#mode-normal').hide()},1500);
	}
});

$('.code-again').click(function(){
	$('.code-again').hide();
	$('.code-countdown').show();
	var time='59';
	var settime = setInterval(function(){
		$('.code-countdown').find('em').html(time)
		if(time == '0'){
			clearInterval(settime);
			$('.code-again').show();
			$('.code-countdown').hide();
			$('.code-countdown').find('em').html('60');
		};
		time--;
	},1000);
})
